<!DOCTYPE html>
<html lang="en-us">

<head>
    <title>免费券使用情况--医院级</title>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="icon" href="favicon.ico" />
    <link href="css/bootstrap.min.css" rel="stylesheet" />
    <link href="css/font-awesome.min.css" rel="stylesheet" />
    <link href="css/default.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap/bootstrap.min.js"></script>
    <script src="js/bootstrap/bootstrap-table.min.js"></script>
    <script src="js/bootstrap/bootstrap-table-zh-CN.min.js"></script>
    <!--[if lt IE 9]>
    <script src="js/bootstrap/html5shiv.min.js"></script>
    <script src="js/bootstrap/respond.min.js"></script>
    <![endif]-->
    <!--页面加载进度条-->
    <link href="css/pace/dataurl.css" rel="stylesheet" />
    <!-- 民生免费券列表页面样式-->
    <link href="css/couponReview.css" rel="stylesheet" />

    <script src="js/pace/pace.min.js"></script>
    <script src="js/jquery.scrolltopcontrol/scrolltopcontrol.js" type="text/javascript"></script>
    <script src="js/jquery.extend.js" type="text/javascript"></script>
    <script src="js/default.js" type="text/javascript"></script>
    <script src="js/jqueryrotate.js" type="text/javascript"></script>
    <script src="js/fileServer.js"></script>
    <!-- 下拉菜单 -->
    <link href="./css/bootstrap-select/bootstrap-select.min.css" rel="stylesheet" />
    <script src="./js/bootstrap-select/bootstrap-select.min.js"></script>
    <script src="./js/bootstrap-select/i18n/defaults-zh_CN.min.js"></script>
    <script src="./js/bootstrap-select/bootstrap-select-custom.js"></script>
    <!-- artTemplate 模板引擎 -->
    <script src="js/template-web.js" type="text/javascript"></script>
    <!-- excel导出操作-->
    <script src="js/exportTable.js"></script>
    <style>
        #mytab,#mytab1 tr,td,th{
            border: 1px solid #ddd !important;
        }
        .fixed-table-container{
            height: inherit !important;
            padding-bottom: 0px !important;
        }
    </style>

</head>

<body>

<div class="maincontent row" style=" overflow: scroll !important;">
    <!--我是主要内容-->
    <div class="panel panel-default">
        <div class="panel-heading">
            查询条件
        </div>
        <div class="panel-body form-group" style="margin-bottom:0px; position:relative;">
            <div class="params-warpper">
                <div class="params-item">
                    <label class="control-label">免费券所属区/县：</label>
                    <select name="search-country" id="search-country" class="form-control value"></select>
                </div>
                <div class="params-item">
                    <label class="control-label">医院所属区/县：</label>
                    <select id="search-customerCountry" class=" form-control value">
                    </select>
                </div>
            </div>
            <div class="params-warpper">
                <div class="params-item">
                    <label class="control-label">送检医院：</label>
                    <select id="search-customer" class="selectpicker form-control value" data-live-search="true" data-max-options="1">
                    </select>
                </div>
                <div class="params-item">
                    <label class="control-label">统计时间段：</label>
                    <input type="date" id="search-starTime" class="form-control value">~<input type="date" id="search-endTime" class="form-control value">
                </div>
                <div class="params-item" style="display: none">
                    <label class="control-label">收费类型：</label>
                    <select name="isCharge" id="isCharge" class="form-control value">
                        <option value="1">免费</option>
                        <option value="2">自费</option>
                    </select>
                </div>
            </div>
            <button class="btn btn-primary" id="search-btn">查询</button>
        </div>
    </div>
    <p class="statisticalTime" style="font-size: 24px;text-align: center"></p>
    <table id="mytab1" class="table table-hover"></table>
    <div id="toolbar1" class="btn-group pull-right" style="margin-right: 20px;">
        <div style="display: flex;flex-direction: row; align-items: center;">
            <!--<a href="pcqrCode.html" class="btn btn-default" style="margin-left: 10px">扫码枪扫码</a>-->
            <!--<a href="javascript:agreeList();" class="btn btn-default" style="margin-left: 10px">批量审核</a>-->
            <a href="javascript:exportTableTop();" class="btn btn-default" style="margin-left: 10px">导出</a>
            <div id="fountainText">
                <div id="fountainText_1" class="fountainText">导</div>
                <div id="fountainText_2" class="fountainText">出</div>
                <div id="fountainText_3" class="fountainText">中</div>
                <div id="fountainText_4" class="fountainText">.</div>
                <div id="fountainText_5" class="fountainText">.</div>
                <div id="fountainText_6" class="fountainText">.</div>
                <div id="fountainText_7" class="fountainText">请</div>
                <div id="fountainText_8" class="fountainText">稍</div>
                <div id="fountainText_9" class="fountainText">后</div>
            </div>
        </div>
    </div>
    <table id="mytab" class="table table-hover"></table>
    <div id="toolbar" class="btn-group pull-right" style="margin-right: 20px;">
        <button id="btn_edit" type="button" class="btn btn-default" style="display: none; border-radius: 0">
            <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>修改
        </button>
        <button id="btn_delete" type="button" class="btn btn-default" style="display: none;">
            <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>删除
        </button>
        <div style="display: flex;flex-direction: row; align-items: center;">
            <a href="javascript:exportTable();" class="btn btn-default" style="margin-left: 10px">导出</a>
            <div id="fountainTextG">
                <div id="fountainTextG_1" class="fountainTextG">导</div>
                <div id="fountainTextG_2" class="fountainTextG">出</div>
                <div id="fountainTextG_3" class="fountainTextG">中</div>
                <div id="fountainTextG_4" class="fountainTextG">.</div>
                <div id="fountainTextG_5" class="fountainTextG">.</div>
                <div id="fountainTextG_6" class="fountainTextG">.</div>
                <div id="fountainTextG_7" class="fountainTextG">请</div>
                <div id="fountainTextG_8" class="fountainTextG">稍</div>
                <div id="fountainTextG_9" class="fountainTextG">后</div>
            </div>
        </div>
    </div>
</div>
</div>
<script type="text/javascript" >
    //区县列表getAddrs
    $.ajax({
        method: 'POST',
        url: '/csfy/intf.do',
        data: { method: 'getAddrsToAccess', parentId: 4301 },
        success: function (res) {
            var options = '<option value="">请选择</option>'
            if (res && res.code == 200) {
                (res.rows || []).forEach(countryItem => {
                    options += '<option value="' + countryItem.name + '">' + countryItem.name + '</option>';
                })
            }
            $('#search-country').html(options);
        }
    });
    $.ajax({
        method: 'POST',
        url: '/csfy/intf.do',
        data: { method: 'getAddrs', parentId: 4301 },
        success: function (res) {
            var options = '<option value="">请选择</option>'
            if (res && res.code == 200) {
                (res.rows || []).forEach(countryItem => {
                    options += '<option value="' + countryItem.name + '">' + countryItem.name + '</option>';
                })
            }
            $('#search-customerCountry').html(options);
        }
    });
    //医院列表
    $.ajax({
        method: 'POST',
        url: '/csfy/intf.do',
        data: {
            method: 'getCustomers',
            addressCity: '长沙市',
        },
        success: function (res) {
            if (res && res.code == 200) {
                var customerList = res.rows || [];
                var customerOptions = '<option value="">请选择医院</option>';
                customerList.forEach(customer => {
                    customerOptions += '<option value="' + customer.customerCode + '">' + customer.customerName + '</option>';
                });
                $('#search-customer').html(customerOptions);
                //$("#search-customer option[value='34']").removeAttr("selected");//默认选中长沙市妇幼保健院
                $('.selectpicker').selectpicker('refresh');
            }
        }
    });

    //获取报表统计截止时间
    $.ajax({
        method: 'POST',
        url: '/csfy/intf.do?method=getStatisticalTime',
        success: function (res) {
            if (res && res.code == 200) {
                var time = Date.parse(res.rows);
                var date = new Date(time);
                $(".statisticalTime").text("数据统计截止时间为：" + date.pattern("yyyy-MM-dd HH:mm:ss"));
            }
        }
    });

    var flagTop = false;
    // 导出表格区县
    function exportTableTop() {
        var query = {};
        //使用时间
        var usedStartTime = $("#search-starTime").val() || '';
        var usedEndTime = $("#search-endTime").val() || '';
        var country = $("#search-country").val() || '';
        var customerCountry = $("#search-customerCountry").val() || '';
        var sendHospitalName = $("#search-customer option:selected").text() || '';
        if (country != '') {
            query.country = country;
        }
        if (customerCountry != '') {
            query.customerCountry = customerCountry;
        }
        if(sendHospitalName == "请选择医院"){
            sendHospitalName = "";
        }
        //使用时间
        if (usedStartTime != '') {
            query.usedStartTime = usedStartTime;
        }
        if (usedEndTime != '') {
            query.usedEndTime = usedEndTime;
        }
        if (sendHospitalName != '') {
            query.customerName = sendHospitalName;
        }
        query.isCharge = $("#isCharge").val();
        var time = new Date().getTime();
        if (!flagTop) {
            flagTop = true
            $("#fountainText").show();
            $.ajax({
                method: 'POST',
                url: '/csfy/intf.do?method=getStatisticsByCountry&couponStatus=2',
                data: query,
                success: function (res) {
                    var delay = 2000 - (new Date().getTime() - time);
                    if (delay < 0) delay = 0;
                    setTimeout(function () {
                        flagTop = false;
                        $("#fountainText").hide();
                        setTimeout(() => {
                            if (res && res.code && res.code == 200) {
                                exportTestReportTopExcel(res.rows);
                            }
                        }, 100)
                    }, delay);
                },
                error: function (err) {
                    flagTop = false;
                    $("#fountainText").hide();
                }
            })
        }
    }

    var flag = false;
    // 导出表格医院级
    function exportTable() {
        var query = {};
        //使用时间
        var usedStartTime = $("#search-starTime").val() || '';
        var usedEndTime = $("#search-endTime").val() || '';
        var country = $("#search-country").val() || '';
        var customerCountry = $("#search-customerCountry").val() || '';
        var sendHospitalName = $("#search-customer option:selected").text() || '';
        if (country != '') {
            query.country = country;
        }
        if (customerCountry != '') {
            query.customerCountry = customerCountry;
        }
        if(sendHospitalName == "请选择医院"){
            sendHospitalName = "";
        }
        //使用时间
        if (usedStartTime != '') {
            query.usedStartTime = usedStartTime;
        }
        if (usedEndTime != '') {
            query.usedEndTime = usedEndTime;
        }
        if (sendHospitalName != '') {
            query.customerName = sendHospitalName;
        }
        query.isCharge = $("#isCharge").val();
        var time = new Date().getTime();
        if (!flag) {
            flag = true
            $("#fountainTextG").show();
            $.ajax({
                method: 'POST',
                url: '/csfy/intf.do?method=getStatisticsByCountryAndCustomerName&couponStatus=2',
                data: query,
                success: function (res) {
                    var delay = 2000 - (new Date().getTime() - time);
                    if (delay < 0) delay = 0;
                    setTimeout(function () {
                        flag = false
                        $("#fountainTextG").hide();
                        setTimeout(() => {
                            if (res && res.code && res.code == 200) {
                                exportTestReportBottomExcel(res.rows);
                            }
                        }, 100)
                    }, delay);
                },
                error: function (err) {
                    flag = false;
                    $("#fountainTextG").hide();
                }
            })
        }
    }

    //退出登录
    function logout() {
        $.ajax({
            url: '/csfy/dologout.do',
            method: 'POST',
            success: function (res) {
                if (JSON.parse(res).code == 200) {
                    window.location.href = "/csfy/index.do"
                }
            }
        })
    }
    //TODO 获取当前登录用户所在的省市区 start
    //设置街道
    function onSteetChange(parentId) {
        town = $("#steetSelect option[value='" + parentId + "']").text();
    }
    //设置地区
    function onCountryChange(parentId) {
        country = $("#countrySelect option[value='" + parentId + "']").text();
        $.ajax({
            method: 'POST',
            url: '/csfy/intf.do',
            data: {
                method: 'getAddrs',
                parentId,
            },
            success: (res) => {
                if (res.code == 200 && res.rows) {
                    var steetList = '';
                    town = '';
                    res.rows.map((item, index) => {
                        if (index == 0) {
                            town = item.name;
                        }
                        steetList += '<option value="' + item.code + '">' + item.name + '</option>'
                    })
                    $("#steetSelect").html(steetList);
                }
            }
        });
    }
    //获取当前登录用户所在的省市区 end

    var idCard = '';//身份证
    var town = '';//街道
    var country = '';//地区
    $("body").click(function () {
        $("#id-card-photo-wrapper").hide(300);
        angle = 0;
        $("#id-card-photo").rotate(0);
    })
    Date.prototype.pattern = function (fmt) {
        var o = {
            "M+": this.getMonth() + 1, //月份
            "d+": this.getDate(), //日
            "h+": this.getHours() % 12 == 0 ? 12 : this.getHours() % 12, //小时
            "H+": this.getHours(), //小时
            "m+": this.getMinutes(), //分
            "s+": this.getSeconds(), //秒
            "q+": Math.floor((this.getMonth() + 3) / 3), //季度
            "S": this.getMilliseconds() //毫秒
        };
        var week = {
            "0": "/u65e5",
            "1": "/u4e00",
            "2": "/u4e8c",
            "3": "/u4e09",
            "4": "/u56db",
            "5": "/u4e94",
            "6": "/u516d"
        };
        if (/(y+)/.test(fmt)) {
            fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
        }
        if (/(E+)/.test(fmt)) {
            fmt = fmt.replace(RegExp.$1, ((RegExp.$1.length > 1) ? (RegExp.$1.length > 2 ? "/u661f/u671f" : "/u5468") : '') + week[this.getDay() + '']);
        }
        for (var k in o) {
            if (new RegExp("(" + k + ")").test(fmt)) {
                fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(('' + o[k]).length)));
            }
        }
        return fmt;
    }
    //根据窗口调整表格高度
    $(window).resize(function () {
        $('#mytab').bootstrapTable('resetView', {
            height: tableHeight()
        })
    })
    //生成用户数据
    $('#mytab1').bootstrapTable({
        method: 'POST',
        contentType: "application/x-www-form-urlencoded",//必须要有！！！！
        url: "/csfy/intf.do?method=getStatisticsByCountry&couponStatus=2",//要请求数据的文件路径
        height: tableHeight(),//高度调整
        toolbar: '#toolbar1',//指定工具栏
        striped: true, //是否显示行间隔色
        dataField: "rows",//bootstrap table 可以前端分页也可以后端分页，这里
        //我们使用的是后端分页，后端分页时需返回含有total：总记录数,这个键值好像是固定的
        //rows： 记录集合 键值可以修改  dataField 自己定义成自己想要的就好
        pageNumber: 1, //初始化加载第一页，默认第一页
        pagination: false,//是否分页
        queryParamsType: 'limit',//查询参数组织方式
        queryParams: queryParams,//请求服务器时所传的参数
        sidePagination: 'server',//指定服务器端分页
        pageSize: 10,//单页记录数
        pageList: [5, 10, 20, 30],//分页步进值
        showRefresh: true,//刷新按钮
        // showColumns: true,
        clickToSelect: true,//是否启用点击选中行
        toolbarAlign: 'left', //工具栏对齐方式
        buttonsAlign: 'left',//按钮对齐方式
        toolbar: '#toolbar1',//指定工作栏
        columns: [
            [
                {
                    title: '区县',
                    field: 'country',
                    align:"center",
                    valign:"middle",
                    colspan: 1,
                    rowspan: 2
                },
                {
                    title: '耳聋基因检查',
                    align:"center",
//                    colspan: 3,
                    colspan: 1,
                    rowspan: 1
                },
                {
                    title: 'NIPT检测',
                    align:"center",
//                    colspan: 3,
                    colspan: 1,
                    rowspan: 1
                },
//                {
//                    title: 'HPV检测',
//                    align:"center",
//                    colspan: 1,
//                    rowspan: 1
//                },
                {
                    title: '产前血清学筛查',
                    align:"center",
                    colspan: 1,
                    rowspan: 1
                },
                {
                    title: '新生儿疾病筛查',
                    align:"center",
                    colspan: 1,
                    rowspan: 1
                },
//                {
//                    title: '地中海贫血基因检测',
//                    align:"center",
//                    colspan: 1,
//                    rowspan: 1
//                }
                {
                    title: '合计',
                    align:"center",
                    field: '总计',
                    valign:"middle",
                    colspan: 1,
                    rowspan: 2
                }
            ],
            [
                {
                    title: '检测数',
                    align:"center",
                    field: "DX0459合计"
                },
//                {
//                    title: '正常',
//                    align:"center",
//                    field: 'DX0459正常'
//                },
//                {
//                    title: '异常',
//                    align:"center",
//                    field: 'DX0459异常'
//                },
                {
                    title: '检测数',
                    align:"center",
                    field: "DX0558合计"
                },
//                {
//                    title: '低风险',
//                    align:"center",
//                    field: 'DX0558低风险'
//                },
//                {
//                    title: '高风险',
//                    align:"center",
//                    field: 'DX0558高风险'
//                },
//                {
//                    title: '检测数',
//                    align:"center",
//                    field: 'DX0532'
//                },
//                {
//                    title: '低风险',
//                    align:"center",
//                    field: 'customerName'
//                },
//                {
//                    title: '高风险',
//                    align:"center",
//                    field: 'customerName'
//                },
                {
                    title: '检测数',
                    align:"center",
                    field: 'BS0001合计'
                },
//                {
//                    title: '低风险',
//                    align:"center",
//                    field: 'customerName'
//                },
//                {
//                    title: '高风险',
//                    align:"center",
//                    field: 'customerName'
//                },
                {
                    title: '检测数',
                    align:"center",
                    field: 'BS0002合计'
                },
//                {
//                    title: '低风险',
//                    align:"center",
//                    field: 'customerName'
//                },
//                {
//                    title: '高风险',
//                    align:"center",
//                    field: 'customerName'
//                },
//                {
//                    title: '检测数',
//                    align:"center",
//                    formatter: formaPoor
//                },
//                {
//                    title: '低风险',
//                    align:"center",
//                    field: 'customerName'
//                },
//                {
//                    title: '高风险',
//                    align:"center",
//                    field: 'customerName'
//                }
            ]
        ],
        locale: 'zh-CN',//中文支持,
        responseHandler: function (res) {
            //在ajax获取到数据，渲染表格之前，修改数据源
            return res;
        },
        onRefresh: function (params) {
            if (params && params.query) {
                return false;
            }
        }
    });
    $('#mytab').bootstrapTable({
        method: 'POST',
        contentType: "application/x-www-form-urlencoded",//必须要有！！！！
        url: "/csfy/intf.do?method=getStatisticsByCountryAndCustomerName&couponStatus=2",//要请求数据的文件路径
        height: tableHeight(),//高度调整
        toolbar: '#toolbar',//指定工具栏
        striped: true, //是否显示行间隔色
        dataField: "rows",//bootstrap table 可以前端分页也可以后端分页，这里
        //我们使用的是后端分页，后端分页时需返回含有total：总记录数,这个键值好像是固定的
        //rows： 记录集合 键值可以修改  dataField 自己定义成自己想要的就好
        pageNumber: 1, //初始化加载第一页，默认第一页
        pagination: true,//是否分页
        queryParamsType: 'limit',//查询参数组织方式
        queryParams: queryParams,//请求服务器时所传的参数
        sidePagination: 'server',//指定服务器端分页
        pageSize: 10,//单页记录数
        pageList: [5, 10, 20, 30],//分页步进值
        showRefresh: true,//刷新按钮
        // showColumns: true,
        clickToSelect: true,//是否启用点击选中行
        toolbarAlign: 'left', //工具栏对齐方式
        buttonsAlign: 'left',//按钮对齐方式
        toolbar: '#toolbar',//指定工作栏
        columns: [
            [
                {
                    title: '优惠券区域',
                    field: 'country',
                    align:"center",
                    valign:"middle",
                    colspan: 1,
                    rowspan: 2
                },
                {
                    title: '机构名称',
                    field: 'customerName',
                    align:"center",
                    valign:"middle",
                    colspan: 1,
                    rowspan: 2
                },
                {
                    title: '耳聋基因检查',
                    align:"center",
//                    colspan: 3,
                    colspan: 1,
                    rowspan: 1
                },
                {
                    title: 'NIPT检测',
                    align:"center",
//                    colspan: 3,
                    colspan: 1,
                    rowspan: 1
                },
//                {
//                    title: 'HPV检测',
//                    align:"center",
//                    colspan: 1,
//                    rowspan: 1
//                },
                {
                    title: '产前血清学筛查',
                    align:"center",
                    colspan: 1,
                    rowspan: 1
                },
                {
                    title: '新生儿疾病筛查',
                    align:"center",
                    colspan: 1,
                    rowspan: 1
                },
//                {
//                    title: '地中海贫血基因检测',
//                    align:"center",
//                    colspan: 1,
//                    rowspan: 1
//                }
            ],
            [
                {
                    title: '检测数',
                    align:"center",
                    field: "DX0459合计"
                },
//                {
//                    title: '正常',
//                    align:"center",
//                    field: 'DX0459正常'
//                },
//                {
//                    title: '异常',
//                    align:"center",
//                    field: 'DX0459异常'
//                },
                {
                    title: '检测数',
                    align:"center",
                    field: "DX0558合计"
                },
//                {
//                    title: '低风险',
//                    align:"center",
//                    field: 'DX0558低风险'
//                },
//                {
//                    title: '高风险',
//                    align:"center",
//                    field: 'DX0558高风险'
//                },
//                {
//                    title: '检测数',
//                    align:"center",
//                    field: 'DX0532'
//                },
//                {
//                    title: '低风险',
//                    align:"center",
//                    field: 'customerName'
//                },
//                {
//                    title: '高风险',
//                    align:"center",
//                    field: 'customerName'
//                },
                {
                    title: '检测数',
                    align:"center",
                    field: 'BS0001合计'
                },
//                {
//                    title: '低风险',
//                    align:"center",
//                    field: 'customerName'
//                },
//                {
//                    title: '高风险',
//                    align:"center",
//                    field: 'customerName'
//                },
                {
                    title: '检测数',
                    align:"center",
                    field: 'BS0002合计'
                },
//                {
//                    title: '低风险',
//                    align:"center",
//                    field: 'customerName'
//                },
//                {
//                    title: '高风险',
//                    align:"center",
//                    field: 'customerName'
//                },
//                {
//                    title: '检测数',
//                    align:"center",
//                    formatter: formaPoor
//                },
//                {
//                    title: '低风险',
//                    align:"center",
//                    field: 'customerName'
//                },
//                {
//                    title: '高风险',
//                    align:"center",
//                    field: 'customerName'
//                }
            ]
        ],
        locale: 'zh-CN',//中文支持,
        responseHandler: function (res) {
            //在ajax获取到数据，渲染表格之前，修改数据源
            return res;
        },
        onRefresh: function (params) {
            if (params && params.query) {
                return false;
            }
            $("#search-country").val('');
            $("#search-customerCountry").val('');
            $("#search-customer").val('');
            $("#search-starTime").val('');
            $("#search-endTime").val('');
        }
    });
    function formaDeaf(value, row, index) {
        return row.DX0459 + row.DX0459异常 + row.DX0459正常;
    }
    function formaNipt(value, row, index) {
        return row.DX0558 + row.DX0558高风险 + row.DX0558低风险;
    }
    function formaPoor(value, row, index) {
        return '-';
    }
    var countryTags = ['区', '市', '县'];
    var townTags = ['街道', '镇', '乡'];
    //请求服务数据时所传参数
    function queryParams(params) {
        var param = new Object();
        var country = $("#search-country").val();
        if (country != null && country != '') {
            param.country = country;
        }
        var customerCountry = $("#search-customerCountry").val();
        if (customerCountry != null && customerCountry != '') {
            param.customerCountry = customerCountry;
        }
        var sendHospitalName = $("#search-customer option:selected").text();
        if (sendHospitalName != '' && sendHospitalName != '请选择医院') {
            param.customerName = sendHospitalName;
        }
        var usedStartTime = $("#search-starTime").val();
        if (usedStartTime != '') {
            param.usedStartTime = usedStartTime;
        }
        var usedEndTime = $("#search-endTime").val();
        if (usedEndTime != '') {
            param.usedEndTime = usedEndTime;
        }
        param.isCharge = $("#isCharge").val();
        param.rows = params.limit;
        param.page = (params.offset + params.limit) / params.limit;

        return param;

        //
        //            return {
        //                //每页多少条数据
        //                rows: params.limit,
        //                //请求第几页
        //                page: (params.offset + params.limit) / params.limit,
        //            }
    }

    //查询按钮事件
    $('#search-btn').click(function () {
        var query = {};
        //使用时间
        var usedStartTime = $("#search-starTime").val() || '';
        var usedEndTime = $("#search-endTime").val() || '';
        var country = $("#search-country").val() || '';
        var customerCountry = $("#search-customerCountry").val() || '';
        var sendHospitalName = $("#search-customer option:selected").text() || '';
        if (country != '') {
            query.country = country;
        }
        if (customerCountry != '') {
            query.customerCountry = customerCountry;
        }
        if(sendHospitalName == "请选择医院"){
            sendHospitalName = "";
        }
        //使用时间
        if (usedStartTime != '') {
            query.usedStartTime = usedStartTime;
        }
        if (usedEndTime != '') {
            query.usedEndTime = usedEndTime;
        }
        if (sendHospitalName != '') {
            query.customerName = sendHospitalName;
        }
        query.isCharge = $("#isCharge").val();
        $('#mytab').bootstrapTable('refresh', { url: '/csfy/intf.do?method=getStatisticsByCountryAndCustomerName&couponStatus=2', query });
        $('#mytab1').bootstrapTable('refresh', { url: '/csfy/intf.do?method=getStatisticsByCountry&couponStatus=2', query });
    })
    //tableHeight函数
    function tableHeight() {
        //可以根据自己页面情况进行调整
        return $(window).height() - 280;
    }
    $("#btn_add").click(function () {
        //TODO
        window.location.href = "/csfy/static/manage-sys/coupon-apply.html"
    });
    var angle = 0;
    $("#ic-rotate").bind("click", function (event) {
        event.stopPropagation();
        $("#id-card-photo").rotate({
            angle: angle,
            animateTo: angle + 90,
            duration: 300,
            callback: function () { angle += 90 }
        });
    });
</script>
<!-- 要导出的送检单table模板 -->
<script id="table" type="text/html">
    <table border="1" class="tables">
        <tr>
            {{each ths item i}}
            <th>{{item.fieldValue}}</th>
            {{/each}}
        </tr>
        {{each trs item i}}
        <tr>
            {{each item value i}}
            <td>{{value}}</td>
            {{/each}}
        </tr>
        {{/each}}
    </table>
</script>
</body>

</html>